﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.IO.IsolatedStorage;

namespace PhoneApp1
{
    public class Client
    {
        public int id { get; set; }
        
        public Guid deviceID;

        public string adresseOrigine { get; set; }

        public string cpOrigine { get; set; }

        public string villeOrigine { get; set; }

        public string longitudeOrigine { get; set; }

        public string latitudeOrigine { get; set; }

        public string longitudeDestination { get; set; }

        public string latitudeDestination { get; set; }

        public int nbPersonne { get; set; }

        public Client()
        {
            //First, generate a GUID on this phone and save it; reuse if it exists to keep consistent with service's data.
            if (IsolatedStorageSettings.ApplicationSettings.Contains("DeviceId"))
            {
                //load existing
                deviceID = (Guid)IsolatedStorageSettings.ApplicationSettings["DeviceId"];
            }
            else
            {
                //generate new ID
                deviceID = Guid.NewGuid();
                IsolatedStorageSettings.ApplicationSettings["DeviceId"] = deviceID;
            }
        }

        public Guid getDeviceID() { return this.deviceID; }
    }
}
